#!/usr/bin/env python
#/home/admin/cai/logs/cronolog/2013/04
"""
output:
[page:0][ip:1][status:2]
"""
import sys
import time
import extractor
from urlparse import urlparse
  
def main():
    begin = time.time()
    parse = extractor.parse
    
    for line in sys.stdin:
        try:  
            v = parse(line)
            url = urlparse(v.refer)
            if url[2].strip() == '-': continue
            page = url[2].strip()
            if page == '': page = '/'
            print('%s%s::%s::%d'%(url[1], page, v.ip, v.status))
        except Exception,ex:
            print >> sys.stderr, ex
            continue
    end = time.time()
    print >> sys.stderr, (end - begin)
    
if __name__ == "__main__":
    main()
